import { request } from '@pkg/request/src';

export enum Api {
  page = '/vipcardGoods/page',
  list = '/vipcardGoods/list',
  get = '/vipcardGoods/get',
  save = '/vipcardGoods/save',
  update = '/vipcardGoods/update',
  remove = '/vipcardGoods/remove',
  deleteById = '/vipcardGoods/deleteById',
  getTargetListByAirport = '/vipcardGoods/getTargetListByAirport',
}

/**
 * 保存或更新
 * @param params
 * @param isUpdate
 */
export const saveOrUpdate = (params, isUpdate) => {
  let url = isUpdate ? Api.update : Api.save;
  return request.post({ url: url, params });
};

/**
 * 查询详情
 * @param params
 */
export const getVipcardGoodsIdDetail = params => {
  return request.get({ url: Api.get, params });
};

export const getTargetListByAirport = params =>
  request.get(
    {
      url: Api.getTargetListByAirport,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );
